# This is the C language backend for awib
# Please refer to the documentation in the full source code distribution
# of awib for additional details

% 10(0) *2 (code) 0 M m
--<<<<<<<<++++++++++++++++++++[->+++>++>+++++>+++++>++++++<<<<<]
++++++++++>>----->>++++++++++<<
% 10 60 *35 100 110 120 0 0 0 (code) 0 M m

# first line of the header  (the include statement)
.>+++++.>.<------.+>--.+++++++++.<.+.<---.+++<.>>>--.+.<-.+++++.>-----.-<<
+++++++++++.----------->-.----<<++.--<.

# loop for the next 9 lines (the define statements)
>>>>>>+++++++++[
% 10 60 35 100 110 120 *i 0 0 (code) 0 M m (where i is loop index from 9 to 1)

# output first part of this define statement
<<<<.>.+.+.+++.>.<----.<---.>.>>>>++++++[-<++++++++>]<.>++++++[-<-------->]
<<<<<++++++++.>>>.<<<+.---------.+++>->>>

# output remainder of this define statement
[->+>+<<]>[-<+>]+>-[-[-[-[-[-[-[-[-[<->[-]]

<[-
% 10 60 35 100 110 120 9 *0 0 (code) 0 M m
<<<<<+++++++.>>++.--<<<+.>++++++.-------------<--.+<.>>>>>>>
]>]

<[-
% 10 60 35 100 110 120 8 *0 0 (code) 0 M m
<<+++++.----->++.-->
]>]

<[-
% 10 60 35 100 110 120 7 *0 0 (code) 0 M m
<<-.<<++++.+.>--.++<----.-<+++++.++.>>++.--<<-.------>>>++++.--->+++.--->
]>]

<[-
% 10 60 35 100 110 120 6 *0 0 (code) 0 M m
<<<++.--<<++++++++.--------<+.>>>>.<<<<--.+<.>>>>>>>
]>]

<[-
% 10 60 35 100 110 120 5 *0 0 (code) 0 M m
<<<++.--<<++++++++++.----------<+.>>>>.<<<<--.+<.>>>>>>>
]>]

<[-
% 10 60 35 100 110 120 4 *0 0 (code) 0 M m
<<<++.+++++.-.<-.+++++.-------.+++>--.<<+++++.++.>>--.--<<-.------<-.+<.>>>>>>>
]>]

<[-
% 10 60 35 100 110 120 3 *0 0 (code) 0 M m
<<<<<+++++++.>>++.--<<+++.----------<+.>>>>.<<<<--.+<.>>>>>>>
]>]

<[-
% 10 60 35 100 110 120 2 *0 0 (code) 0 M m
<<<<-.<<+.>>++++.--.>++++++.<--.+++++.-------.>--.<<+++++.+.<--.>>++++++++.
---.<-.>---.<<+++.-.->++++++++.-------.+.------->>--.--<<<+.>>.+<<--.+<.>>>>>>>
]>]

<[-
% 10 60 35 100 110 120 1 *0 0 (code) 0 M m
<<<<<+++++++.>>++.--<<+.--------<+.>>>>.<<<<--.+<.>>>>>>>
]>

<<-]

# output remainder of header
% 10 60 35 100 110 120 *0 0 0 (code) 0 M m
<<<-.+++++.-------.>++++.<<---.>+.>+++.<++++.-----------.<<------------.>>>>.<
<+++++++++++....---------.<<+++++++++++.<.>>>++++++++++++.+++++.>-.<<.>-.-----
-------.++++++++.+++++.<++++++++.+.>>>+++.<<<<<.>>>-----------.+++++.-------.>
--.<<---------.++++++++++.>>--.<<<++.>>+.>+++++.<++++.<<--.<.>>>+++.+++++.>-.<
<----------.>-----------.<<.<.
[-]>[-]>[-]>[-]>[-]>[-]>>>>
% 9(0) *(code) 0 M m

# for each op PQ output "eP(Q)\n" with P and Q as ascii strings
[
% 9(0) *P Q (code) 0 M m
<<++++++++++[->++++++++++<]>+.-[--<+>>+<]>--.[-]
>[-<<<<<<<+>>>>>>>]<<<----------.+[->>>+<<<]<<<<
# itoa
% *A 0 0 0 0 0 0    (where A is the cell to output)
>>>>+[+++++++++[-<++++++++++>]+<[-<<+<[>-]>[>]<[-
>>>[-]<<<]<->>>]>[-<+>>+<]<[->+<]>]>[>++++++[-<++
++++++>]+<.[-]]<<<<++++++++++[-<++++++++++>]>>>+[
<++++++++++[-<<+<[>-]>[>]<[->>>[-]<<<]<->>>]>[-<+
>>+<]<[->+<]>]>[>[-]++++++[-<++++++++>]<.[-]]>[++
+++[-<++++++++>]<.[-]>]<<<<<++++++++++[-<++++++>]
<--.[-]
% *0 0 0 0 0 0 0
>>>>>>>.[-]++++++++++.---------->
]

# output footer
% *0 M m
>[-]>[-]++++++++++[->+++++++++++>+++>+++++<<<]
>++++.-------------.+++++++++++++++.+.---.----.>++.>--.+++++++++++.
<<+++++++++++++++.>>>++++++++++.[-]<[-]<[-]<[-]
